import axios from '../utils/axios';

// 定义接口类型
interface LoginParams {
  username: string;
  password: string;
}

interface SurveyResponse {
  id: string;
  question: string;
  answer: string;
}

// API 类
class ApiService {
  // 用户相关
  static async login(params: LoginParams) {
    return axios.post('/auth/login', params);
  }

  static async getUserProfile() {
    return axios.get('/user/profile');
  }

  // 问卷相关
  static async submitSurvey(answer: string): Promise<SurveyResponse> {
    return axios.post('/survey/submit', { answer });
  }

  static async getSurveyHistory() {
    return axios.get('/survey/history');
  }

  // 示例：获取首页数据
  static async getHomeData() {
    return axios.get('/home/data');
  }
}

export default ApiService; 